import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login.vue'),
    meta: {
      title: '登录'
    }
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('@/views/home.vue'),
    meta: {
      title: '首页'
    },
    redirect:'/home/blogTitle',
    children: [
      {
      path: '/home/blogTitle',
      name: 'blogTitle',
      component: () => import('@/components/BlogTitle.vue'),
      meta: {
        title: '首页'
      },
    },
    {
      path: '/home/blogArchive',
      name: 'blogArchive',
      component: () => import('@/components/BlogArchive.vue'),
      meta: {
        title: '归档'
      },
    },
    {
      path: '/home/blogContent',
      name: 'blogContent',
      component: () => import('@/components/BlogContent.vue'),
      meta: {
        title: '内容'
      },
    },
    {
      path: '/home/blogSearch',
      name: 'blogSearch',
      component: () => import('@/components/BlogSearch.vue'),
      meta: {
        title: '搜索'
      },
    },
    {
      path: '/home/blogTags',
      name: 'blogTags',
      component: () => import('@/components/BlogTags.vue'),
      meta: {
        title: '标签' //
      },
    },
    {
      path: '/home/aboutMe',
      name: 'aboutMe',
      component: () => import('@/components/AboutMe.vue'),
      meta: {
        title: '关于' 
      },
    },
  ]
  },{
    path: '/portal',
    name: 'portal',
    conponent: ()=>import('@/views/portal.vue'),
    mata:{
      title: '大厅'
    }
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
  return routerPush.call(this, location).catch((error) => error)
}

export default router